<template>

    <!--列表-->
    <el-table :data="shops"  @selection-change="selsChange" style="width: 100%;" >

        <!--显示多选框-->
        <el-table-column type="selection" width="55">
        </el-table-column>
        <el-table-column prop="name" label="店铺名称" >
        </el-table-column>
        <el-table-column prop="tel" label="商铺电话" >
        </el-table-column>
        <el-table-column prop="address" label="地址" >
        </el-table-column>
        <el-table-column prop="logo" label="商铺商标" >
        </el-table-column>
        <el-table-column label="操作" >
            <template scope="scope">
                <el-button type="primary" size="small" @click="pass(scope.$index, scope.row)">通过</el-button>
                <el-button type="danger" size="small" @click="nopass(scope.$index, scope.row)">驳回</el-button>
            </template>
        </el-table-column>
    </el-table>
</template>

<script>
    export default {
        data() {
            return {
                shops:[],

            }
        },
        methods:{
            selsChange(){

            },
            pass(index,row){
                //console.debug(row)
                this.$confirm('此操作将通过店铺申请审核, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(()=>{
                    this.$http.put("/shop/updateState/"+row.id).then(res=>{
                        //console.debug(sels)
                        //解构表达式
                        let {success,msg} = res.data
                        if(success){
                            this.$message({
                                message: '审核通过',
                                type: 'success'
                            });
                            this.getShopList();
                        }
                    })
                }).catch(()=>{
                    this.$message("取消通过")
                })
            },
            nopass(){

            },
            getShopList(){
                this.$http.get("/shop/getShopByState").then(res=>{
                    console.debug(res)
                    this.shops = res.data
                })
            }
        },
        mounted(){
            this.getShopList()
        }
    }
</script>
